//
//  ThirdView.m
//  iphone.sprintview
//
//  Created by wangjun on 10-12-1.
//  Copyright 2010 __MyCompanyName__. All rights reserved.
//
#import "ThirdView.h"
#import "TableViewCell.h"
@implementation ThirdView
@synthesize myTableView,mylist;
-(void) drawRect:(CGRect)rect
{
	self.mylist = [NSMutableArray arrayWithCapacity:20];
}
- (void)dealloc {
	[self.mylist release];
	[self.myTableView release];
    [super dealloc];
}
#pragma mark -
#pragma mark UItableView
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
	return 5;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {	
	static NSString *CellIdentifier = @"CustomCellIdentifier"; 
    TableViewCell *cell = (TableViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 
    if (cell == nil) { 
        NSArray *array = [[NSBundle mainBundle] loadNibNamed:@"TableViewCell" owner:self options:nil]; 
        cell = [array objectAtIndex:0]; 
		cell.myTableDelegate=self;
        [cell setSelectionStyle:UITableViewCellSelectionStyleNone]; 
    } 
    [[cell myLable] setText:@"123"]; 
	[[cell myButton] setTag:[indexPath row]];
	return cell;
}
#pragma mark -
#pragma mark 处理选中事件
-(void)checkedButton:(id)sender checked:(BOOL)checked
{
	if (checked) {
		//选中
		[self.mylist addObject:[NSString stringWithFormat:@"%d",[sender tag]]];
	}else {
		//取消
		[self.mylist removeObject:[NSString stringWithFormat:@"%d",[sender tag]]];
	}
	NSLog(@"===%@",self.mylist);
}
@end
